return do_dom0_op(xc_handle, &op);
}
+int xc_domain_sethandle(int xc_handle, uint32_t domid,
+ xen_domain_handle_t handle)
+{
+ dom0_op_t op;
+ op.cmd = DOM0_SETDOMAINHANDLE;
+ op.u.setdomainhandle.domain = (domid_t)domid;
+ memcpy(op.u.setdomainhandle.handle, handle, sizeof(xen_domain_handle_t));
+ return do_dom0_op(xc_handle, &op);
+}
+
/*
* Local variables:
* mode: C
return zero;
}
+static PyObject *pyxc_domain_sethandle(PyObject *self,
+ PyObject *args,
+ PyObject *kwds)
+{
+ XcObject *xc = (XcObject *)self;
+
+ int i;
+ uint32_t dom;
+ PyObject *pyhandle;
+ xen_domain_handle_t handle;
+
+ static char *kwd_list[] = { "dom", "handle", NULL };
+
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iO", kwd_list,
+ &dom, &pyhandle) )
+ return NULL;
+
+ if ( !PyList_Check(pyhandle) ||
+ (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
+ {
+ out_exception:
+ errno = EINVAL;
+ PyErr_SetFromErrno(xc_error);
+ return NULL;
+ }
+
+ for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
+ {
+ PyObject *p = PyList_GetItem(pyhandle, i);
+ if ( !PyInt_Check(p) )
+ goto out_exception;
+ handle[i] = (uint8_t)PyInt_AsLong(p);
+ }
+
+ if ( xc_domain_sethandle(xc->xc_handle, dom, handle) < 0 )
+ return PyErr_SetFromErrno(xc_error);
+
+ Py_INCREF(zero);
+ return zero;
+}
+
static PyObject *pyxc_domain_getinfo(PyObject *self,
PyObject *args,
PyObject *kwds)
" cpuweight [float, 1]: VCPU being pinned.\n"
"Returns: [int] 0 on success; -1 on error.\n" },
+ { "domain_sethandle",
+ (PyCFunction)pyxc_domain_sethandle,
+ METH_VARARGS | METH_KEYWORDS, "\n"
+ "Set domain's opaque handle.\n"
+ " dom [int]: Identifier of domain.\n"
+ " handle [list of 16 ints]: New opaque handle.\n"
+ "Returns: [int] 0 on success; -1 on error.\n" },
+
{ "domain_getinfo",
(PyCFunction)pyxc_domain_getinfo,
METH_VARARGS | METH_KEYWORDS, "\n"
unsigned int max; /* maximum number of vcpus */
} dom0_max_vcpus_t;
+#define DOM0_SETDOMAINHANDLE 44
+typedef struct {
+ domid_t domain;
+ xen_domain_handle_t handle;
+} dom0_setdomainhandle_t;
typedef struct {
uint32_t cmd;
dom0_platform_quirk_t platform_quirk;
dom0_physical_memory_map_t physical_memory_map;
dom0_max_vcpus_t max_vcpus;
+ dom0_setdomainhandle_t setdomainhandle;
uint8_t pad[128];
} u;
} dom0_op_t;